package org.alex.netShop.pages;

import java.util.LinkedList;


import org.alex.netShop.beans.SellerBean;
import org.alex.netShop.interfaces.Purchase;
import org.alex.netShop.interfaces.Seller;
import org.alex.netShop.interfaces.Sellers;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.ioc.annotations.Inject;

public class AddSeller
{
	@Persist
	@Property
	private Seller seller;

	@InjectPage
	private ViewSeller viewSellerPage;
	@InjectPage
	private Error errorPage;
	
	@Inject
	private Sellers sellers;
	
	@SetupRender
	public void createObject() {
		seller = new SellerBean();
		seller.setPurchase(new LinkedList<Purchase>());
	}

	void onSuccess() {
		sellers.save(seller);
	}

}
